package com.wangjie.exception;

import com.wangjie.enums.ResultCodeEnum;

// 自定义异常
public class BusinessException extends RuntimeException {
    // 异常状态码
    private Integer code;

    public BusinessException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    public Integer getCode() {
        return code;
    }
}
